var comanyInfo = {}
$.ajax({
    type: 'get',
    url: gloabApi + "/Companyinfo/getInfo",
    data: {},
    dataType: 'json',
    success: function (res) {
        if (res.code == 1) {
            comanyInfo = res.data
            document.getElementById('address').innerHTML = comanyInfo.addr
            document.getElementById('email').innerHTML = comanyInfo.email
            document.getElementById('mobile').innerHTML = comanyInfo.mobile

        } else {
            layer.msg(res.msg);
        }
    },
})// 登陆判断
function checkLogin(){
    let userinfoStr = localStorage.getItem('userinfo')
    console.log(userinfoStr)
    let userinfo = JSON.parse(userinfoStr)
    console.log(userinfo)
    if(userinfo){
        document.getElementById('login').style.display = 'none'
        document.getElementById('userName').style.display = 'inline-block'
        document.getElementById('loginOut').style.display = 'inline-block'
        document.getElementById('userName').innerHTML = userinfo.name

        
    }else{
        document.getElementById('login').style.display = 'inline-block'
        document.getElementById('userName').style.display = 'none'
        document.getElementById('loginOut').style.display = 'none'
    }
}
checkLogin()
$('#loginOut').on('click',()=>{
    layer.confirm('确定退出？', {
        btn: ['确定','取消'] //按钮
        }, function(){
            localStorage.clear()
            window.location.href = './index.html'
        });
})
